<template>
  <div class="wrap">
    <a-button @click="handleLogin">登录</a-button>
  </div>
</template>
<script lang="ts" setup>
import { FieldStringOutlinedIconType } from '@ant-design/icons-vue/lib/icons/FieldStringOutlined';
import { reactive } from 'vue'
import { useRoute, useRouter} from 'vue-router'

const route = useRoute()
const router = useRouter()

const s: string[] = ['a', 'b']
let str: string = s[0]

const handleLogin = () => {
  console.log(route, route.query.callback_url)
  if (route.query.callback_url) { 
    // https://blog.csdn.net/weixin_48786946/article/details/107616922
    // 会报错  使用类型断言(类型断言更像是类型的选择，而不是类型转换)
    // return  window.location.href = route.query.callback_url
    return window.location.href = route.query.callback_url as string
  }
  return router.push('/home')
}
</script>
<style scoped lang="scss">

</style>